package com.coocaa.internship.controller;

import com.coocaa.internship.common.ResultData;
import com.coocaa.internship.pojo.DeliverCv;
import com.coocaa.internship.service.serviceImpl.DeliverCvServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description: 投递简历controller
 * @Author: zwh
 * @Date: 2019-08-02
 * @Time: 0:43
 */
@Controller
@RequestMapping("/deliverCv")
public class DeliverCvController {

    @Autowired
    DeliverCvServiceImpl deliverCvService;


    @RequestMapping(value = "/selectByCvId", method = RequestMethod.GET)
    @ResponseBody
    public ResultData selectDeliverCvByCvId(@RequestParam("userCvId") Long userCvId) {
        return deliverCvService.selectDeliverCvByCvId(userCvId);
    }

    @RequestMapping(value = "/selectByUserId", method = RequestMethod.GET)
    @ResponseBody
    public ResultData selectDeliverCvByUserId(@RequestParam("userId") Long userId) {
        return deliverCvService.selectDeliverCvByUserId(userId);
    }

    @RequestMapping(value = "/delete", method = RequestMethod.GET)
    @ResponseBody
    public ResultData deleteDeliverCvByCvId(@RequestParam("userCvId") Long userCvId, @RequestParam("positionId") Long positionId) {
        return deliverCvService.deleteDeliverCvByCvId(userCvId, positionId);
    }

    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    @ResponseBody
    public ResultData insertDeliverCv(DeliverCv deliverCv) {
        return deliverCvService.insertDeliverCv(deliverCv);
    }

}
